﻿using System;

namespace Entities
{
    [Serializable]
    public class Schedule
    {
        private int scheduleID;
        private DateTime startDate;
        private DateTime endDate;
        private int status;
        private string trainID;
        public Schedule()
        { }
        public Schedule(int scheduleID, DateTime startDate, DateTime endDate, int status, string trainID)
        {
            this.scheduleID = scheduleID;
            this.startDate = startDate;
            this.endDate = endDate;
            this.status = status;
            this.trainID = trainID;
        }
        public int ScheduleID
        {
            get { return this.scheduleID; }
            set
            {
                if (value < 0)
                    throw new Exception("scheduleID not allow nullvalue.");
                this.scheduleID = value;
            }
        }
        public DateTime StartDate
        {
            get { return this.startDate; }
            set { this.startDate = value; }
        }
        public DateTime EndDate
        {
            get { return this.endDate; }
            set { this.endDate = value; }
        }
        public int Status
        {
            get { return this.status; }
            set { this.status = value; }
        }
        public string TrainID
        {
            get { return this.trainID; }
            set { this.trainID = value; }
        }
        public override string ToString()
        {
            return this.scheduleID + "; " + this.startDate + "; " + this.endDate + "; " + this.status + "; " + this.trainID + "; ";
        }
        public override bool Equals(Object obj)
        {
            Schedule me = (Schedule)obj;
            bool ret = this.ScheduleID.Equals(me.ScheduleID);
            return ret;
        }
        public override int GetHashCode()
        {
            return this.ScheduleID.GetHashCode();
        }

    }
}